<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="_fragments :: head(~{::title})">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>首页</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
    <link rel="stylesheet" href="../static/css/me.css">
</head>
<body class="bg3">
<div id="pjax-container">
<!--导航-->
<nav th:replace="_fragments :: menu(1)" class="ui inverted attached segment m-shadow-small"></nav>
<!--中间-->
    <div class="m-padded-tb-big">
        <div class="ui container">
            <div class="ui stackable grid">
                <!--            中间头部-->
                <div class="animated fadeInLeft eleven wide column">
                    <div class="ui top white-transform attached segment" style="border: 0">
                        <div class="ui middle aligned two column grid">
                            <div class="column">
                                <h2 class="ui header" style="color: #ece2ff"><i class="heartbeat icon"></i>blogs</h2>
                            </div>
                            <div class="right aligned column">
                                <div class="ui header m-inline-block" style="color: #ffe9f9">共
                                    <h2 class="ui header m-inline-block" th:text="${pageInfo.total}" style="color: #d8fff8">2</h2> 篇
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--                中间内容-->
                    <div class="ui attached white-transform container grey segment m-padded-tb-large" style="border: 0">
                        <div class="ui padded vertical segment" th:each="blog : ${pageInfo.list}">
                            <div class="ui mobile reversed stackable grid">
                                <div class="eleven wide column">
                                    <h3 class="ui header"><a href="#" class="m-black" target="_blank"
                                                                 th:href="@{/blog/{id}(id=${blog.id})}"
                                                                 th:text="${blog.title}">浮躁时代的一点纯真</a>
                                    </h3>
                                    <br>
                                    <p><a href="#" class="m-black" target="_blank" th:href="@{/blog/{id}(id=${blog.id})}"
                                          th:text="${blog.description}">在十多年前的那个夜晚，星星闪烁着金黄色的微光</a></p>
                                    <div class="ui grid m-padded-bottom-mini">
                                        <div class="eleven wide column">
                                            <div class="ui horizontal link list mini">
                                                <div class="item">
                                                    <img src="https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=4195665098,552692922&fm=26&gp=0.jpg"
                                                         th:src="@{${blog.user.avatar}}" alt="" class="ui avatar image">
                                                    <div class="content"><a href="#" class="header"
                                                                            th:text="${blog.user.nickname}">ljk</a>
                                                    </div>
                                                </div>
                                                <div class="item">
                                                    <i class="calendar m-black icon"></i><span
                                                        class="ui middle aligned"
                                                        th:text="${#dates.format(blog.updateTime, 'yyyy-MM-dd')}">2021-1-17</span>
                                                </div>
                                                <div class="item">
                                                    <i class="eye icon"></i><span
                                                        class="ui middle aligned"
                                                        th:text="${blog.views}">1111</span>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="right aligned four wide column">
                                            <a href="#" th:href="@{/types/{id}(id=${blog.type.id})}" target="_blank"
                                               class="ui white-transform label m-padded-tb-small" style="color: black"
                                               th:text="${blog.type.name}">分类</a>
                                        </div>
                                    </div>
                                </div>
                                <div class="ui five wide column middle aligned">
                                    <a href="#" th:href="@{/blog/{id}(id=${blog.id})}" target="_blank">
                                        <img src="https://images.unsplash.com/photo-1610990275491-54fc65bb732f?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=925&q=80"
                                             th:src="@{${blog.firstPicture}}" alt="" class="ui rounded image">
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--                中间底部-->
                    <div class="ui animated fadeInUp white-transform bottom grey attached segment" style="border: 0">
                        <div class="ui inverted divided stackable grid">
                            <div class="two wide column" align="center">
                                <div class="item"><a class="m-black" th:href="@{/index}">首页</a></div>
                            </div>
                            <div class="two wide column" align="center">
                                <div class="item"><a class="m-black"
                                        th:href="@{/index(pageNum=${pageInfo.hasPreviousPage}?${pageInfo.prePage}:1)}">上一页</a>
                                </div>
                            </div>

                            <div class="eight wide m-text-thin column" align="center">
                                <style>p{display: inline;}</style>
                                <p style="color:#ff0028;">第</p> <span style="color:#ff661e;" th:text="${pageInfo.pageNum}"></span> <p style="color: #fff74f">页~</p><p style="color: #bcff20">共<span
                                    style="color: #76ffc8" th:text="${pageInfo.pages}"></span><p style="color: #cae7ff">页</p><p style="color: #7ad2ff">~有</p> <span
                                    style="color: #c8fff8" th:text="${pageInfo.total}"></span> <p style="color: #685dff">篇</p><p style="color: #ca77ff">文</p><p style="color: #ffb7f2">章</p>
                            </div>

                            <div class="two wide column" align="center">
                                <div class="item"><a class="m-black"
                                        th:href="@{/index(pageNum=${pageInfo.hasNextPage}?${pageInfo.nextPage}:${pageInfo.pages})}">下一页</a>
                                </div>
                            </div>
                            <div class="two wide column" align="center">
                                <div class="item"><a class="m-black" th:href="@{/index(pageNum=${pageInfo.pages})}">尾页</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!--右边的top-->
                <div class="five wide column">
                    <!--               分类-->
                    <div class="ui animated fadeInRight segments">
                        <div class="ui secondary white-transform segment">
                            <div class="ui two column grid">
                                <div class="column"><i class="idea icon"></i>分类
                                </div>
                                <div class="right aligned column">
                                    <a href="#" th:href="@{types/-1}" target="_blank">more<i
                                            class="angle double right icon"></i></a>
                                </div>
                            </div>
                        </div>
                        <div class="ui grey white-transform">
                            <div class="ui blue-transform fluid vertical menu">
                                <a href="#" th:href="@{/types/{id}(id=${type.id})}" target="_blank" class="item"
                                   th:each="type : ${types}">
                                    <span th:text="${type.name}">学习日志</span>
                                    <div class="ui left top pointing label"
                                         th:text="${#arrays.length(type.blogs)}">6
                                    </div>
                                </a>
                            </div>
                        </div>
                    </div>
                    <!--                标签-->
                    <div class="ui animated fadeInRight m-margin-top-large segments">
                        <div class="ui secondary white-transform segment">
                            <div class="ui two column grid">
                                <div class="column"><i class="tags icon"></i>标签
                                </div>
                                <div class="right aligned column">
                                    <a href="#" th:href="@{tags/-1}" target="_blank">more<i
                                            class="angle double right icon"></i></a>
                                </div>
                            </div>
                        </div>
                        <div class="ui grey white-transform segment">
                            <a href="#" th:href="@{/tags/{id}(id=${tag.id})}" target="_blank" th:each="tag : ${tags}"
                               class="ui blue-transform left pointing label m-margin-tb-tiny">
                                <span th:text="${tag.name}">数据结构</span>
                                <div class="detail" th:text="${tag}!=null ? ${#arrays.length(tag.blogs)}">10
                                </div>
                            </a>
                        </div>
                    </div>


                    <!--                最新推荐-->
                    <div class="ui animated fadeInUp segments m-margin-top-large">
                        <div class="ui secondary white-transform segment">
                            <div class=""><i class="bookmark icon"></i>最新推荐</div>
                        </div>
                        <div class="ui grey white-transform segment">
                            <div class="ui blue-transform segment" th:each="blog : ${recommendBlogs}">
                                <a href="#" th:href="@{/blog/{id}(id=${blog.id})}" target="_blank"
                                   class="m-black m-text-thin" th:text="${blog.title}">JavaSE</a>
                            </div>
                        </div>
                    </div>

                    <!--                二维码-->
                    <div class="ui horizontal divider header m-text-thin m-margin-top" style="color: #ffecf7">扫码关注我</div>
                    <div class="ui centered card" style="width: 12em">
                        <img src="../static/image/wechat.jpg" th:src="@{/image/wechat.jpg}" alt=""
                             class="ui rounded image">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!--底部-->
<footer th:replace="_fragments :: footer" class="ui inverted vertical segment m-padded-tb-massive"></footer>
<!--/*/<th:block th:replace="_fragments :: script">/*/-->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js"></script>
<!--/*/</th:block>/*/-->

<!--利用jQuery获取到菜单-->
<script>
    $('.menu.toggle').click(function () {
        $('.m-item').toggleClass('m-mobile-hide');
    });

</script>
<script>
    $(function() {
        $(document).pjax('a[target!="_blank"]', '#pjax-container',{fragment: '#pjax-container',timeout: 8000, type: 'GET'});

        $(document).on('submit', 'form', function(event) {
            //var container = $(this).closest('[pjax-container]');
            $.pjax.submit(event, '#pjax-container', {
                fragment:'#pjax-container', timeout:8000
            });
        });
    })
</script>

</body>
</html>